import request from '@/utils/request'

// 根据账号、租户系统获取角色
export function GetRoleSystem(Account,TenantID) {
  return request({
    url: `/api/Authorization/GetRoleSystem?Account=${Account}&TenantID=${TenantID}`,
    headers: {
      isToken: false
    },
    method: 'get',
  })
}

// 根据账号获取租户系统
export function GetTenantSystem(data) {
  return request({
    url: `/api/Authorization/GetTenantSystem?Account=${data}`,
    headers: {
      isToken: false
    },
    method: 'get',
  })
}

// 获取终端标识
export function GetIndentityMark(data) {
  return request({
    url: '/api/Authorization/GetIndentityMark',
    headers: {
      isToken: false
    },
    method: 'get',
    data: data
  })
}

// 根据页面标识 生成二维码
export function GetVerificateImgWithMark(IndentityMark,Length) {
  return request({
    url: `/api/Authorization/GetVerificateImgWithMark?IndentityMark=${IndentityMark}&Length=${Length}`,
    headers: {
      isToken: false
    },
    method: 'get',
    responseType: 'arraybuffer'
  })
}
// 快速登录方法
export function Login_Velocity(data) {
  return request({
    url: '/api/Authorization/Login_Velocity',
    headers: {
      isToken: false,
    },
    method: 'post',
    data: data
  })
}
// 登录 WEB
export function Login_Web(data) {
  return request({
    url: '/api/Authorization/Login_Web',
    headers: {
      isToken: false,
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function GetCurrentUser() {
  return request({
    url: '/api/Authorization/GetCurrentUser',
    method: 'get'
  })
}

// ------------------------------------------------------------

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/login',
    headers: {
      isToken: false,
      repeatSubmit: false
    },
    method: 'post',
    data: data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/getInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}